import { Component, OnInit } from '@angular/core';
import { Router }  from '@angular/router';
import { LoginService } from '../../service/login.service';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  isLogin:any;
  constructor(private loginService:LoginService, private _router:Router ){}
  user:any = {"username":"","password":""};

  ngOnInit(){
    this.isLogin = JSON.parse(localStorage.getItem("isLogin"));
    if(this.isLogin != null && this.isLogin != undefined){
      this._router.navigate(['/page','']);
    }
  }


  login():void{
    this.loginService.login(this.user);
  }





}
